<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var obj = {}

        var arr = [];

        var obj2 = null;

        // 以一个对象为原型创建一个新的对象，这个对象的属性是可以控制权限。
        ;(function(){
            var _index = '';
            obj2 = Object.create(obj,{
                name:{
                    // value:"老王",
                    //    writable:true
                    get:function(){
                            // console.log(this.a);
                            // 操作
                        return `《${_index}》`;
                    },
                    set:function(val){
                        // 都可以拿到修改过的值
                        arr.push(val);

                        _index = val;
                    },
                    configurable:true,
                    enumerable:true
                }
            })
        })();

        obj2.name = "三国演义";
        obj2.name = "水浒传";
        obj2.name = "西游记";
        obj2.name = "红楼梦";

        console.log(obj2);

        console.log(arr);

        
       

    </script>
</body>
</html>